from rest_framework import serializers
from rest_framework.generics import ListAPIView, RetrieveAPIView

from activities.models import Activity


class ActivityListSerializer(serializers.ModelSerializer):
    class Meta:
        model = Activity
        fields = ["id", "bg_image", "title", "start", "city", "status"]


class ActivityListView(ListAPIView):
    # queryset = Activity.objects.all().order_by('-start')
    queryset = Activity.objects.all()
    serializer_class = ActivityListSerializer
    # def get(self,request):
    # qs=Activity.objects.all()
    # serializer = ActivityListSerializer(qs,many=True)
    # return Response(serializers.data)


class ActivityDetailSerializer(serializers.ModelSerializer):
    class Meta:
        model = Activity
        # fields = "__all__"
        exclude = ["reads", "applys"]


class ActivityDetailView(RetrieveAPIView):
    queryset = Activity.objects.all()
    serializer_class = ActivityDetailSerializer
